<?php
	$conn = mysql_connect("localhost","root","1234") or die(mysql_error());
	$db = mysql_select_db("book_db") or die("Cannot select db");
	mysql_query("SET character_set_results=tis620");
    mysql_query("SET character_set_client=tis620");
    mysql_query("SET character_set_connection=tis620");
	mysql_query("SET NAMES windows");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>รายชื่อสมาชิก</title>
<? 
$_SESSION["MemID"] =  $result["MemID"];
 $result = mysql_query("SELECT * FROM member WHERE MemID = '".$_POST['id']."'");
 if($_POST[search]){
 $result = mysql_query("SELECT * FROM member  WHERE MemID LIKE '$_POST[keyword]' " );
}else{
 $result = mysql_query("SELECT *  FROM member");
}
?>
<style type="text/css">
body {
	background-color: #82AFFB;
}
</style>
</head>

<body>
<table width="1120" height="397" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="8"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/banner.jpg" width="1134" height="525" /></td>
  </tr>
  <tr>
    <td width="140"><a href="file:///G|/pppppppppppppppppppppppppp/bok/list_officer.php"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin1.jpg" width="140" height="40" /></a></td>
    <td width="140"><a href="file:///G|/pppppppppppppppppppppppppp/bok/list_member.php"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin2.jpg" width="140" height="40" /></a></td>
    <td width="140"><a href="file:///G|/pppppppppppppppppppppppppp/bok/booklist_data.php"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin3.jpg" width="140" height="40" /></a></td>
    <td width="140"><a href="file:///G|/pppppppppppppppppppppppppp/bok/list_pub.php"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin4.jpg" width="140" height="40" /></a></td>
    <td width="140"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin5.jpg" width="140" height="40" /></td>
    <td width="140"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin6.jpg" width="140" height="40" /></td>
    <td width="140"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin7.jpg" width="140" height="40" /></td>
    <td width="154"><img src="file:///G|/pppppppppppppppppppppppppp/bok/image/menuadmin8.jpg" width="153" height="40" /></td>
  </tr>
  <tr>
    <td colspan="8"><form id="form1" name="form1" method="post" action="">
      <p><center>
 
        <p>แสดงรายชื่อสมาชิกทั้งหมด </p>
        <p><a href="file:///G|/pppppppppppppppppppppppppp/bok/add_members.php">เพิ่มข้อมูลสมาชิก</a></p></center>
      <table width="1133" height="101" border="1" align="center">
        <tr>
          <center><td width="94" height="33">รหัสสมาชิก</td></center>
          <center><td width="109">ชื่อ - นามสกุล</td></center>
          <center><td width="88">ชื่อเล่น</td></center>
          <center><td width="123">ปี/เดือน/วัน เกิด</td></center>	
          <center><td width="64">เพศ</td></center>
          <center><td width="129">เลขที่บัตรประชาชน</td></center>
          <center><td width="47">ที่อยู่</td></center>
          <center><td width="105">เบอร์โทรศัพท์</td></center>
          <center><td width="57">อีเมล์</td></center>
          <center><td width="65">ปี/เดือน/วัน ที่สมัครสมาชิก</td></center>
          <center><td width="66">ประเภทสมาชิก</td></center>
          <center><td width="56">แก้ไขข้อมูล</td></center>
          <center><td width="48">ลบข้อมูล</td></center>
<?php 
   $rows = mysql_num_rows($result);
   if($rows > 0){
   for ($i=0;$i<$rows; $i++){
     mysql_data_seek($result,$i);
         $data[$i] = mysql_fetch_array($result)
 ?>
   
  <tr>
            <td align="center"><? echo  $data[$i]['MemID'] ?>&nbsp;</td>
            <td align="center"><? echo $data[$i]['MemName']; ?>&nbsp;</td>
            <td align="center"><? echo $data[$i]['MemNick']; ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemBirth'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemSex'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemNum'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemAddress'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemTel'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemEmail'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemRegister'] ?>&nbsp;</td>
            <td align="center"><? echo  $data[$i]['MemType'] ?>&nbsp;</td>
            <td align="center"><a href="edit_members.php?MemID=<?=$data[$i]["MemID"];?>">แก้ไขข้อมูล</a></td>
            <td align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='delete_member.php?MemID=<?php echo $data[$i]["MemID"];?>';}">ลบข้อมูล</a></td>
            </tr>
        <? 
   }  // end for
 }  // end if rows > 0
 ?>
        </table>
    </form></td>
  </tr>
</table>
</body>
</html>